package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.CommonBean;
import com.beiing.tianshuai.tianshuai.entity.PersonalDataCardBean;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalDataCardModel;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalDataCardModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.PersonalDataCardViewImpl;

/**
 * Created by Jinni on 2017/8/3 0003.
 */

public class PersonalDataCardPresenter extends BasePresenter implements PersonalDataCardPresenterImpl, PersonalDataCardModel.OnRequestListener {

    private PersonalDataCardViewImpl mView;
    private PersonalDataCardModelImpl mModel;

    public PersonalDataCardPresenter(PersonalDataCardViewImpl view) {
        mView = view;
        mModel = new PersonalDataCardModel(this);
    }

    @Override
    public void getPersonalInfoBean(String uid) {
        mView.showProgress();
        mModel.getPersonalInfoBean(uid);
    }

    @Override
    public void isFriend(String fUid, String tUid) {
        mModel.isFriend(fUid, tUid);
    }

    @Override
    public void getDelFriendRequestResult(String uid, String toUid) {
        mView.showProgress();
        mModel.getDelFriendRequestResult(uid, toUid);
    }

    @Override
    public void onSuccess(PersonalDataCardBean bean) {
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onDelSuccess(CommonBean bean) {
        mView.hideProgress();
        mView.getDelFriendResult(bean);
    }

    @Override
    public void isFriend(CommonBean bean) {
        mView.isFriend(bean);
    }

    @Override
    public void onError(Throwable e) {
        mView.hideProgress();
        mView.onRequestFailed(e);
    }
}
